home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sea_cabin_commie_ai.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  180 lines

  1.  
  2. # Jones 3D Cog Script
  3. #
  4. # SEA_Cabin_Commie_AI.cog
  5. # Controls the AI and population of the corridor patrolling commies on the Pudovkin
  6. #
  7. # [JM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15. message         startup
  16. message         crossed
  17. message         killed
  18.  
  19. # ==================== SUBROUTINES ===================
  20.  
  21. flex            NewSailor           local
  22. flex            RandomSailorPicker  local
  23.  
  24. # =================== REFERENCES ===============================
  25.  
  26. thing           Commie00            LinkID=1         
  27. thing           Commie01=-1         LinkID=1        local #Does not start as a thing... but wil be created later
  28.  
  29. thing           CommieGhost00       
  30. thing           CommieGhost01
  31.  
  32. surface         AdjoinAIOn0         LinkID=2
  33. surface         AdjoinAIOn1         LinkID=2
  34. surface         AdjoinAIOn2         LinkID=2
  35. surface         AdjoinAIOn3         LinkID=2
  36.          
  37. surface         AdjoinAIOff0        LinkID=3 
  38. surface         AdjoinAIOff1        LinkID=3
  39. surface         AdjoinAIOff2        LinkID=3
  40. surface         DeckAdjoinAIOff3    LinkID=3    #this one is the first time the player goes above deck, and will start the commie generation process
  41.  
  42. surface         WakeCommie00        LinkID=4
  43.  
  44.  
  45. # ===================== MISC LOCAL VARIABLES ===================
  46.  
  47. int         counter             local
  48. int         TempCommie          local
  49. int         StartCheck=0        local
  50.  
  51. int         WakeCheck=0         local
  52.  
  53. int         CommieGrowthCounter=0       local
  54.  
  55.  
  56. # ==================== CONSTANTS ==========================
  57.  
  58. int         NUMBER_OF_COMMIES=2             local
  59. int         COMMIE_GROWTH_LIMIT=4           local
  60.  
  61. # ======================== COMMIE TEMPLATES =======================
  62.  
  63. template        TokarevTPL02=Sailor_Tokarev3    local
  64. template        TokarevTPL03=Sailor_Tokarev4    local
  65.  
  66.  
  67. # =========================================================
  68. end
  69.  
  70. # ======================= CODE =============================
  71. code
  72.  
  73. # =========================================================
  74. startup:
  75.  
  76.     AISetCutsceneMode(Commie00);
  77.              
  78.     return;
  79.  
  80. # =========================================================
  81. crossed:
  82.     
  83.     if(GetSenderID() == 4 && WakeCheck == 0)
  84.     {
  85.         AIClearCutsceneMode(Commie00);
  86.         WakeCheck = 1;
  87.     }
  88.     
  89.     if(WakeCheck == 0) return;
  90.     
  91.     if(GetSenderID() == 2)
  92.     {
  93.         for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1) 
  94.         {
  95.             if(Commie00[counter] != -1)
  96.             {
  97.                 AISetInstinctWpntMode(Commie00[counter]);
  98.                 AIEnableInstinct(Commie00[counter], "roam", 1);
  99.             }
  100.         }
  101.     }
  102.     else if(GetSenderID() == 3)
  103.     {
  104.         for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  105.         {
  106.             if(Commie00[counter] != -1)
  107.             {
  108.                 AIClearInstinctWpntMode(Commie00[counter]);
  109.                 AIEnableInstinct(Commie00[counter], "roam", 0);
  110.             }
  111.         }
  112.         
  113.         if(CommieGrowthCounter >= COMMIE_GROWTH_LIMIT)
  114.         {
  115.             Call NewSailor;
  116.         }        
  117.     }
  118.     
  119.     if(StartCheck == 1) return;
  120.     
  121.     else if(GetSenderRef() == DeckAdjoinAIOff3)
  122.     {
  123.         StartCheck = 1;
  124.         Call NewSailor;
  125.     }
  126.  
  127.     
  128.     return;
  129.     
  130. # =========================================================
  131. killed:
  132.  
  133.     TempCommie = GetSenderRef();
  134.         
  135.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  136.     {
  137.         if(Commie00[counter] == TempCommie)
  138.         {
  139.             Commie00[counter] = -1;
  140.         }
  141.     }
  142.     
  143.     return;
  144.  
  145. # ============================================================
  146. //Makes a new Commie if one of the two commies in the hallways have died.   
  147. NewSailor:
  148.     
  149.     if(StartCheck == 0) return;
  150.     
  151. //  if(RandBetween(0, 2) > 1) return;
  152.     
  153.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  154.     {
  155.         if(Commie00[counter] == -1)
  156.         {
  157.             Commie00[counter] = CreateThing(TokarevTPL03, CommieGhost00[counter]);
  158.             
  159.             if (Commie00[counter] == -1)
  160.             {
  161.                 sleep(10);
  162.                 Call NewSailor;
  163.                   
  164.             return;
  165.             }         
  166.             
  167.             CaptureThing(Commie00[counter]);
  168.             
  169.             CommieGrowthCounter = CommieGrowthCounter + 1;
  170.         }
  171.     }
  172.     
  173.     return;
  174.  
  175. # ============================================================
  176.  
  177. end
  178.